package com.demo.patch.model;

import java.sql.Date;
import java.util.Map;

import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;

public class Patch extends Model<Patch> {

  /**
	 * 
	 */
  private static final long serialVersionUID = 1L;
  public static final Patch dao = new Patch();

  public boolean save(String filename) {
    Map<String, Object> userAttrs = getAttrs();
    userAttrs.put("uploaddate", new Date(System.currentTimeMillis()));
    userAttrs.put("fileupload", filename);
    return super.save();
  }

  public Page<Patch> paginate(int pageNumber, int pageSize) {
    return paginate(pageNumber, pageSize, "select *", "from patch order by id asc");
  }
}
